#include<type_traits>
#include <iostream>
using namespace std;

template<typename T>
typename enable_if<is_integral<T>::value, T>::type fun(const T& v)
{
	cout<< v << " is integral!\n";
	return v;
}

struct A
{
	friend ostream& operator<<(ostream& out, const A& ca)
	{
		out<< "A: ";
		return out;
	}
};

template<typename T>
typename enable_if<is_class<T>::value, T>::type fun(const T& v)
{
	cout<< v << " is class!\n";
	return v;
}

int main(void)
{
	long a = 100;
	fun<decltype(a)>(a);
	
	A ca;
	fun<decltype(ca)>(ca);
		
	return 0;
}

